from celery.schedules import crontab
from kombu import Exchange, Queue

broker_url = 'redis://:jGWNoYsT4plmj8oi@adm-rank.redis.hotgrid.cn:6379/1'
result_backend = 'redis://:jGWNoYsT4plmj8oi@adm-rank.redis.hotgrid.cn:6379/1'

beat_schedule = {
    'crontab_hour_ranks_task': {
        'task': 'scheduler.tasks.crontab_hour_ranks_task',
        'schedule': crontab(minute='55')
    },
    'crontab_hour_rank171_task': {
        'task': 'scheduler.tasks.crontab_hour_rank171_task',
        'schedule': crontab(minute=15)
    },
    'crontab_hour_crawl_task': {
        'task': 'scheduler.tasks.crontab_hour_crawl_task',
        'schedule': crontab(minute='17,35,55')
    },
    'crontab_hour_crawl_delay4_task': {
        'task': 'scheduler.tasks.crontab_hour_crawl_delay4_task',
        'schedule': crontab(minute=30)
    },
    'crontab_hour_crawl_delay6_task': {
        'task': 'scheduler.tasks.crontab_hour_crawl_delay6_task',
        'schedule': crontab(minute=10)
    },
    'crontab_hour_standard_task': {
        'task': 'scheduler.tasks.crontab_hour_standard_task',
        'schedule': crontab(minute='17,40')
    },
    'crontab_hour_standard_delay2_task': {
        'task': 'scheduler.tasks.crontab_hour_standard_delay2_task',
        'schedule': crontab(minute='22')
    },
    'crontab_hour_standard_delay4_task': {
        'task': 'scheduler.tasks.crontab_hour_standard_delay4_task',
        'schedule': crontab(minute=30)
    },
    'crontab_hour_standard_delay6_task': {
        'task': 'scheduler.tasks.crontab_hour_standard_delay6_task',
        'schedule': crontab(minute=10)
    },
    'crontab_hour_micro_delay1_rank160_task': {
        'task': 'scheduler.tasks.crontab_hour_micro_delay1_rank160_task',
        'schedule': crontab(minute='10,35,50')
    },
    'crontab_hour_micro_delay4_task': {
        'task': 'scheduler.tasks.crontab_hour_micro_delay4_task',
        'schedule': crontab(minute=30)
    },
    'crontab_hour_micro_delay6_task': {
        'task': 'scheduler.tasks.crontab_hour_micro_delay6_task',
        'schedule': crontab(minute=10)
    },
    'crontab_hour_micro_delay1_rank8_task': {
        'task': 'scheduler.tasks.crontab_hour_micro_delay1_rank8_task',
        'schedule': crontab(minute=15)
    },
    'crontab_hour_rank187_hours5_task': {
        'task': 'scheduler.tasks.crontab_hour_rank187_hours5_task',
        'schedule': crontab(minute='10,30,45,50')
    },
    'crontab_day_task': {
        'task': 'scheduler.tasks.crontab_day_task',
        'schedule': crontab(hour=5, minute=0)
    },
    'crontab_day_crawl_task': {
        'task': 'scheduler.tasks.crontab_day_crawl_task',
        'schedule': crontab(minute=30, hour=7)
    },
    'crontab_day_rank7_rank110_task': {
        'task': 'scheduler.tasks.crontab_day_rank7_rank110_task',
        'schedule': crontab(minute='17,57', hour='10,11,12,14')
    },
    'crontab_hour_rank8_task': {
        'task': 'scheduler.tasks.crontab_hour_rank8_task',
        'schedule': crontab(minute='10', hour='2')
    },
    'crontab_day_rank187_days2_task': {
        'task': 'scheduler.tasks.crontab_day_rank187_days2_task',
        'schedule': crontab(minute='35', hour='5,7,8,9,10,11,12,13,14,15,16')
    },
    'crontab_week_monday_task': {
        'task': 'scheduler.tasks.crontab_week_monday_task',
        'schedule': crontab(hour=6, minute=0, day_of_week='mon')
    },
    'crontab_week_friday_task': {
        'task': 'scheduler.tasks.crontab_week_friday_task',
        'schedule': crontab(hour=6, minute=0, day_of_week='fri')
    },
    'crontab_month_task': {
        'task': 'scheduler.tasks.crontab_month_task',
        'schedule': crontab(hour=14, minute=15)
    },
    'crontab_month_rank7_rank110_task': {
        'task': 'scheduler.tasks.crontab_month_rank7_rank110_task',
        'schedule': crontab(minute='12', hour='12,14')
    },
    'crontab_year_task': {
        'task': 'scheduler.tasks.crontab_year_task',
        'schedule': crontab(hour='5,14', minute=15)
    },
    'crontab_dongao12345_task': {
        'task': 'scheduler.tasks.crontab_dongao_12345_task',
        'schedule': crontab(minute=45)
    },
    'crontab_dongao6_task': {
        'task': 'scheduler.tasks.crontab_dongao_6_task',
        'schedule': crontab(hour='14', minute='0,10,20,30,40,50')
    },
    'crontab_dongao78910_task': {
        'task': 'scheduler.tasks.crontab_dongao_78910_task',
        'schedule': crontab(hour='9')
    },
    'crontab_v2tov0_task': {
        'task': 'scheduler.tasks.crontab_v2tov0_task',
        'schedule': crontab(hour='0,12,18', minute='0,10,20,30,40,50')
    }
}

imports = ('scheduler.tasks',)

task_routes = {'scheduler.tasks.crontab_*': {"queue": "celery_crontab"}}

timezone = 'Asia/Shanghai'

# task_serializer: 'json'
# accept_content: ['json']  # Ignore other content
# result_serializer: 'json'

worker_hijack_root_logger = False

result_expires = 60 * 60

task_serializer = 'msgpack'
result_serializer = 'msgpack'
accept_content = ["msgpack"]
